package com.vhall.component.controller.version;

import com.vhall.component.controller.version.facade.VersionManageFacade;
import com.vhall.component.entity.version.vo.ReqVersionManagePage;
import com.vhall.component.entity.version.vo.RespVersionManagePage;
import com.vhall.component.entity.version.vo.VersionManageVO;
import com.vhall.component.framework.common.annotation.VhallComponent;
import com.vhall.component.plugin.common.annotation.VssTokenAuth;
import com.vhall.component.service.version.VersionManageService;
import lombok.RequiredArgsConstructor;

/**
 * @author jingwen.li
 */
@RequiredArgsConstructor
@VhallComponent
public class VersionManageController implements VersionManageFacade {

    private final VersionManageService versionManageService;

    @Override
    public boolean addVersionManage(VersionManageVO vo) {
        return versionManageService.add(vo) > 0;
    }

    @Override
    public boolean update(VersionManageVO vo) {
        return versionManageService.update(vo) > 0;
    }

    @Override
    public boolean delete(Integer id) {
        return versionManageService.delete(id) > 0;
    }

    @Override
    public RespVersionManagePage page(ReqVersionManagePage reqVersionManagePage) {
        return versionManageService.pageList(reqVersionManagePage.getPlatform(),
                reqVersionManagePage.getPage(),
                reqVersionManagePage.getPageSize());
    }

    @Override
    public VersionManageVO info(Integer id) {
        return versionManageService.getInfo(id);
    }

    @Override
    public VersionManageVO detail(String pf, String version) {
        return versionManageService.getInfo(pf, version);
    }
}
